<!DOCTYPE html>
<html lang="zh_cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>登录</title>
    <link rel="stylesheet" href="{{asset('layuiadmin/layui/css/layui.css')}}" media="all">
    <link rel="stylesheet" href="{{asset('admin/css/logins.css')}}" />
</head>

<style>
    body, html {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
 
        margin: 0;
        padding: 0;
    }
    #background {
        position: fixed;
        top: 0;
        left: 0;

        z-index: -100;
    }
</style>
<body class="beg-login-bg" style="overflow: hidden">
<canvas id="background"></canvas>
<div class="container login">

    <div class="content">
        <canvas id="demo-canvas"></canvas>
        <div id="large-header" class="large-header">
            <div class="main-title" style="z-index: 3">
                <div class="beg-login-box">
                    <header>
                        <h1>后台登录</h1>
                    </header>
                    <div class="beg-login-main">
                        <form class="layui-form layui-form-pane">
                            @csrf
                            <div class="layui-form-item">
                                <label class="beg-login-icon fs1">
                                    <i class="layui-icon">&#xe66f;</i>
                                </label>
                                <input type="text" name="username" placeholder="请输入登录名" class="layui-input" value="" lay-verify="required">
                            </div>
                            <div class="layui-form-item">
                                <label class="beg-login-icon fs1">
                                    <i class="layui-icon">&#xe673;</i>
                                </label>
                                <input type="password"  name="password" placeholder="请输入密码" class="layui-input" value="" lay-verify="required">
                            </div>
                            <div class="layui-form-item">
                                <label class="beg-login-icon fs1">
                                    <i class="layui-icon">&#xe679;</i>
                                </label>
                                <input type="text" name="code" id="captcha" placeholder="验证码" autocomplete="off" class="layui-input" style="text-indent: 27px;" lay-verify="required">
                                <div class="captcha" style="border: none;">
                                    <img src="{{captcha_src()}}" alt="" onclick="this.src=this.src+'?'+'id='+Math.random()" style="cursor: pointer;height:48px;border-radius:3px;margin-top: 0px;width: 120px;" >
                                </div>
                            </div>
                            <div class="layui-form-item" style="text-shadow:2px 2px 6px rgba(0,0,0,0.4);color:red !important;">
                                <button type="submit" class="layui-btn btn-submit btn-blog login-button" lay-submit lay-filter="login">登录&nbsp;<i class="fa fa-sign-in" aria-hidden="true"></i></button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
<script src="{{asset('layuiadmin/layui/layui.js')}}"></script>
<script src="{{asset('admin/js/background.min.js')}}"></script>
<script src="{{asset('admin/js/rAF.js')}}"></script>
<script src="{{asset('admin/js/logins.js')}}"></script>
<script>
    layui.use(['form','layer'],function(){
        var form = layui.form,layer = layui.layer,$ = layui.jquery;
        form.on('submit(login)', function(data){
            $.post("{{url('adminlogin')}}",data.field,function(res){
                if(res.code == 1){
                    layer.msg(res.msg,function () {
                        window.location.href = "{{url('admin/index/index')}}";
                    });
                }else{
                    $('#captcha').val('');
                    layer.msg(res.msg);
                    $('.captcha img').attr('src','{{captcha_src()}}?id='+Math.random());
                }
            },'json');
            return false;
        });
    });
</script>
